<form action="" id="myform">
<?php foreach ($find_contract as $contract_item): ?>
<div id="inline1">
<h2><span>合同信息</span></h2>
<table>
    <tr><th colspan="7">基本信息：</th></tr>
    <tr>
        <td class="name" width="80">主题：</td>
        <td>&nbsp;</td>
        <td colspan="5"  id="customer_name"><?= $contract_item->subject ?></td>
    </tr>
    <tr>
        <td class="name" width="80" >对应客户：</td>
        <td>&nbsp;</td>
        <td colspan="5"><?= $contract_item->customer_name ?></td>
    </tr>
    <tr>
        <td class="name" width="80">对应机会：</td>
        <td>&nbsp;</td>
        <td colspan="5"><?= $contract_item->opportunity_subject ?></td>
    </tr>
    <tr>
        <td class="name" width="80" >合同号：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->contract_no ?></td>
        <td>&nbsp;</td>
        <td class="name" width="80" style="padding-left:0px;">总金额：</td>
        <td>&nbsp;</td>
        <td width="170"><?php if($contract_item->total_amount):?> <?= $contract_item->total_amount ?>万元 <?php endif;?></td>
    </tr>
    <tr>
        <td class="name" width="80" >付款方式：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->payment_type ?></td>
        <td>&nbsp;</td>
        <td class="name" width="80">交付地点：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->payment_address ?></td>
    </tr>
    <tr>
        <td class="name" width="80" >开始时间：</td>
        <td>&nbsp;</td>
        <?php 
        $starttime= '';
        if($contract_item->start_time != '0000-00-00 00:00:00'){
        	$datatime = strtotime($contract_item->start_time);
        	$starttime = date( "Y-m-d",$datatime);
        }
        ?>
        <td width="170"><?= $starttime  ?></td>
        <td>&nbsp;</td>
        <td class="name" width="80">结束时间：</td>
        <td>&nbsp;</td>
        <?php 
        $endtime= '';
        if($contract_item->end_time != '0000-00-00 00:00:00'){
        	$datatime = strtotime($contract_item->end_time);
        	$endtime = date( "Y-m-d",$datatime);
        }
        ?>
        <td width="170"><?= $endtime?></td>
    </tr>
    <tr>
        <td class="name" width="80" >产品：</td>
        <td>&nbsp;</td>
        <td colspan="5"><?= $contract_item->product ?></td>
    </tr>
    <tr>
        <td class="name" width="80">客户签约人：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->customer_contract ?></td>
        <td>&nbsp;</td>
        <td class="name" width="80" >我方签约人：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->our_contract ?></td>
    </tr>
    <tr>
        <td class="name" width="80">所有者：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->user_name ?></td>
        <td>&nbsp;</td>
        <td class="name" width="80" >签约时间：</td>
        <td>&nbsp;</td>
        <?php 
        $signingtime= '';
        if($contract_item->signing_time != '0000-00-00 00:00:00'){
        	$datatime = strtotime($contract_item->signing_time);
        	$signingtime = date( "Y-m-d",$datatime);
        }
        ?>
        <td width="170"><?= $signingtime?></td>
    </tr>
    <tr><th colspan="7">执行状态：</th></tr>
    <tr>
        <td class="name" width="80">回款金额：</td>
        <td>&nbsp;</td>
        <td width="170"><?php if($contract_item->payment_amount):?> <?= $contract_item->payment_amount ?>万元<?php endif;?></td>
        <td>&nbsp;</td>
        <td class="name" width="80" >状态：</td>
        <td>&nbsp;</td>
        <td width="170"><?= $contract_item->status ?></td>
    </tr>
    <tr><th colspan="7">其他：</th></tr>
    <tr>
        <td class="gj_name" width="80">合同正文及<br />附件：</td>
        <td>&nbsp;</td>
        <td height="80" colspan="5" valign="top"><a href="index.php/contract/download/<?= $contract_item->contract_id ?>"><?= $contract_item->real_file_name ?></a></td>
    </tr>
    <tr>
        <td class="gj_name" width="80">备注：</td>
        <td>&nbsp;</td>
        <td height="80" colspan="5" valign="top"><?= $contract_item->remark ?></td>
    </tr>
    <?php if($payment_records):?>
    <tr><th colspan="5">回款记录：</th></tr>
    <?php endif;?>
    <?php foreach($payment_records as $payment_record):?>
    <?php 
    $datatime = strtotime($payment_record->payment_time);
    $payment_time = date( "Y-m-d",$datatime);
    ?>
        <tr>
            <td colspan="7"><span class="span_right">期次：<?= $payment_record->stages?></span><span class="span_right">金额：<?= $payment_record->money?></span><span class="span_right">日期：<?php echo $payment_time;?></span></td>
        </tr>
 	<?php endforeach;?>
    <tr><td colspan="5">&nbsp;</td></tr>
</table>
</div>
 <?php endforeach; ?>
 </form>